﻿@model ProjectZhunYunModel
@{
    ViewBag.Title = "打印准运证";
}
@section CSS{
    <link href="@Url.Content("~/Content/Zhunyun.css")" rel="stylesheet" type="text/css" />
}
@section BodyNav
{
    > @Html.ActionLink("工程列表", "List", "Project") > 打印准运证
}
@section JS
{
    <script src="@Url.Content("~/Scripts/LodopFuncs.js")" type="text/javascript"></script>
    <object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width="0"
        height="0">
        <param name="Border" value="0">
        <embed id="LODOP_EM" type="application/x-print-lodop" width="0" height="0"></embed>
    </object>
    <script type="text/javascript">
        var LODOP; //声明为全局变量 
        function prn1_preview() {
            LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
            LODOP.SET_PRINTER_INDEX(@Model.PrinterId);
            //LODOP.SET_PRINT_PAGESIZE(2,'990px','640px','zhunyun');
            LODOP.SET_PRINT_PAGESIZE(2,'640px','990px','zhunyun');
            LODOP.SET_SHOW_MODE('LANDSCAPE_DEFROTATED',1);
            LODOP.SET_PRINT_MODE("POS_BASEON_PAPER",true);
            LODOP.SET_PRINT_MODE('AUTO_CLOSE_PREWINDOW',1);
             LODOP.SET_PRINT_STYLE('FontSize',11);
            CreateOneFormPage();
            LODOP.PREVIEW();
            if (confirm("是否已打印完毕？")) {
                $.post("/Project/ZhunYunPrintSuccess", { 'id': @Model.Id }, function (result) {
                    if (result == "true")
                        alert('操作成功');
                    else
                        alert("操作失败");
                });
            }

           // LODOP.PRINT_DESIGN();
        };
        function CreateOneFormPage() {
            $('div.print').each(function()
            {
                LODOP.ADD_PRINT_TEXT($(this).attr('top'),$(this).attr('left'),$(this).attr('width'),$(this).attr('height'),$(this).html());
            });
        };
    </script>
}
<h1>
    打印《起重机械登记证》</h1>
<table class="detail">
    <tr>
        <td>
            <div id="dvZhunyun">
                <div id="dvName" class="print" top="235" left="235" width="306" height="20">@Model.Name</div>
                <div id="dvAddress" class="print" top="235" left="625" width="269" height="20">@Model.Address</div>
                <div class="ClearBoth">
                </div>
                <div id="dvEquipmentInfo" class="print" top="277" left="329" width="449" height="20">@Model.EquipmentName  @Model.EquipmentModel</div>
                <div id="dvDemolition" class="print" top="321" left="235" width="276" height="20">@Model.DemolitionCompany</div>
                <div id="dvConstructDateTime" class="print" top="321" left="625" width="276" height="20">@Model.ConstructDateTime</div>
                <div class="ClearBoth">
                </div>
                <div id="dvInspectCompany" class="print" top="366" left="235" width="276" height="20">@Model.InspectCompany</div>
                <div id="dvInspectTime" class="print" top="366" left="625" width="276" height="20">@Model.InspectTime</div>
                <div id="dvConstruction" class="print" top="404" left="235" width="276" height="20">@Model.ConstructionCompany</div>
                <div id="dvDemolitionTime" class="print" top="404" left="625" width="276" height="20">@Model.ExpiredDate</div>
                <div class="ClearBoth">
                </div>
                <div id="dvEquipmentNO" class="print" top="450" left="180" width="276" height="20">@Model.InspectNO</div>
                <div id="dvTimeYear" class="print" top="510" left="730" width="40" height="20">@DateTime.Now.ToString("yyyy")</div>
                <div id="dvTimeMonth" class="print" top="510" left="803" width="40" height="20">@DateTime.Now.ToString("MM")</div>
                <div id="dvTimeDay" class="print" top="510" left="860" width="40" height="20">@DateTime.Now.ToString("dd")</div>
            </div>
        </td>
    </tr>
    <tr>
        <td>
            <input type="button" value="打印" class="btnBtn" onclick="prn1_preview()" />
            @Html.ActionLink("返回工程", "Detail", "Project", new { Id = Model.Id }, new { @class = "lnkBtn" })
            @Html.ActionLink("返回列表", "List", "Project", null, new { @class = "lnkBtn" })
        </td>
    </tr>
</table>
